package com.gmall.search.controller;


import com.gmall.common.result.Result;
import com.gmall.model.search.Goods;
import com.gmall.search.service.ESSyncService;
import com.gmall.search.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/search")
public class GoodsController {


    @Autowired
    ESSyncService esSyncService;

    @Autowired
    GoodsService goodsService;
    @GetMapping("/clickSku/{skuId}")
    public Result<Long> clickSku(@PathVariable Long skuId) {
        return esSyncService.clickSku(skuId);
    }

    @GetMapping("/getGoodsById/{skuId}")
    public Result<Goods> getGoodsById(@PathVariable Long skuId) {
        return goodsService.getGoodsById(skuId);
    }
}
